/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2021-12-10     xu       the first version
 */
#ifndef APPLICATIONS_MESSAGE_TYPE_H_
#define APPLICATIONS_MESSAGE_TYPE_H_

#include <rtthread.h>

enum key_id { ID_NONE, ID_KEY1, ID_KEY2, ID_KEY3 };

enum key_state {
    STATE_INVALID,
    STATE_RELEASE,
    STATE_PRESSED,
};

struct key_event {
    rt_uint8_t key;
    rt_uint8_t state;
};

enum view_cmd_type {
    VIEW_INVLIAD,
    VIEW_MONTHLY,
    VIEW_DAILY,
};

struct view_command {
    rt_uint8_t view;
};

enum network_cmd_type {
    NETWORK_INVALID,
    NETWORK_TIME_SYNC,
    NETWORK_CN_DATE_GET,
};

struct network_command {
    rt_uint8_t cmd;
};

enum message_type {
    MSG_INVALID,
    MSG_KEY_EVENT,
    MSG_VIEW_COMMAND,
    MSG_NETWORK_COMMAND,
};

struct message {
    int type;
    union {
        struct key_event key_event;
        struct view_command view_command;
        struct network_command network_command;
    } data;
};

#endif /* APPLICATIONS_MESSAGE_TYPE_H_ */